package com.fan.admin.service.impl;

import com.fan.admin.dao.CourseRelationMapper;
import com.fan.admin.service.CourseRelationService;
import com.fan.commons.pojo.ClaInfo;
import com.fan.commons.pojo.Course;
import com.fan.commons.pojo.CourseRelation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fan
 * @date 2021/3/9
 */
@Service
public class CourseRelationServiceImpl implements CourseRelationService {

	@Autowired
	private CourseRelationMapper courseRelationMapper;

	@Override
	public int insertCourseRelation(CourseRelation courseRelation) {
		return courseRelationMapper.insertCourseRelation(courseRelation);
	}

	@Override
	public int deleteRelationById(Integer id) {
		return courseRelationMapper.deleteRelationById(id);
	}

	@Override
	public int deleteCourseByCourseId(String courseId) {
		return courseRelationMapper.deleteCourseByCourseId(courseId);
	}

	@Override
	public int deleteRelationActive(CourseRelation courseRelation) {
		return courseRelationMapper.deleteRelationActive(courseRelation);
	}

	@Override
	public List<CourseRelation> queryRelation(@Param("courseId") String courseId) {
		return courseRelationMapper.queryRelation(courseId);
	}

	@Override
	public List<ClaInfo> queryAllNoCla(String courseId) {
		return courseRelationMapper.queryAllNoCla(courseId);
	}

	@Override
	public List<Course> queryStudentCourse(CourseRelation courseRelation) {
		return courseRelationMapper.queryStudentCourse(courseRelation);
	}

	@Override
	public List<Course> queryStudentChooseCourse(String studentId) {
		return courseRelationMapper.queryStudentChooseCourse(studentId);
	}
}
